#include <REGX52.H>
#include <INTRINS.H>
#include "LCD1602.h"

void attitude()
{
    LCD_ShowString(1,1,"Attitude        ");
    LCD_ShowString(2,1,"   Is Everything");
}

void well_begun()
{
    LCD_ShowString(1,1,"Well Begun      ");
    LCD_ShowString(2,1,"    Is Half Done");
}

void nike()
{
    LCD_ShowString(1,1, "   Just Do It   ");
}

void apple()
{
    LCD_ShowString(1,1, "Think           ");
    LCD_ShowString(2,1, "       Different");
}

void kiss()
{
    LCD_ShowString(1,1,"Keep It         ");
    LCD_ShowString(2,1,"  Simple, Stupid");
}

void believe()
{
    LCD_ShowString(1,1,"Believe In      ");
    LCD_ShowString(2,1,"     Your Dreams");
}

void stay()
{
    LCD_ShowString(1,1,"Stay Hungry     ");
    LCD_ShowString(2,1,"    Stay Foolish");
}

void love()
{
    LCD_ShowString(1,1,"Do What You Love");
    LCD_ShowString(2,1,"Love What You Do");
}

void keep()
{
    LCD_ShowString(1,1,"Keep Looking    ");
    LCD_ShowString(2,1,"    Don't Settle");
}



void Delay1000ms();
 
void main()
{
    unsigned int saying_index = 0;
    char changed = 0;
    void (*sayings[])(void) = {attitude, well_begun,nike,apple,kiss,believe,stay,love,keep};
    int MAX_SAYING = sizeof(sayings) / sizeof(sayings[0]);

    LCD_Init();

    while (1)
    {
        LCD_Clear();
        sayings[saying_index]();
        saying_index++;
        saying_index%=MAX_SAYING;
        Delay1000ms();
        Delay1000ms();
        Delay1000ms();
    }
    

}

void Delay1000ms()		//@11.0592MHz
{
	unsigned char i, j, k;

	_nop_();
	i = 8;
	j = 1;
	k = 243;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
}


